package com.easychat.entity.po;

import com.easychat.entity.enums.UserContactTypeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;


/**
 * 会话用户
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ChatSessionUser implements Serializable {

	private static final long serialVersionUID = -567978987654321L;

	private Integer memberCount;

	private String lastMessage;

	private Integer contactType;

	private Long lastReceiveTime;
	/**
	 * 用户人ID
	 */
	private String userId;

	/**
	 * 联系人ID
	 */
	private String contactId;

	/**
	 * 会话ID
	 */
	private String sessionId;

	/**
	 * 联系人名称
	 */
	private String contactName;

	public Integer getContactType() {
		Integer type = UserContactTypeEnum.getByPrefix(contactId).getType();
		return type;
	}

	public void setUserId(String userId){
		this.userId = userId;
	}

	public String getUserId(){
		return this.userId;
	}

	public void setContactId(String contactId){
		this.contactId = contactId;
	}

	public String getContactId(){
		return this.contactId;
	}

	public void setSessionId(String sessionId){
		this.sessionId = sessionId;
	}

	public String getSessionId(){
		return this.sessionId;
	}

	public void setContactName(String contactName){
		this.contactName = contactName;
	}

	public String getContactName(){
		return this.contactName;
	}

	@Override
	public String toString (){
		return "用户人ID:"+(userId == null ? "空" : userId)+"，联系人ID:"+(contactId == null ? "空" : contactId)+"，会话ID:"+(sessionId == null ? "空" : sessionId)+"，联系人名称:"+(contactName == null ? "空" : contactName);
	}
}
